/*
 * @Author: yushuang
 * @Date: 2024-12-19 11:19:56
 * @LastEditors: yushuang
 * @LastEditTime: 2024-12-19 11:20:17
 * @Description:
 */
import type { App, Directive } from 'vue';
import { useAccess } from '@/composables/access';

export const accessDirective: Directive = (el, binding) => {
  const { hasAccess } = useAccess();
  if (!hasAccess(binding.value)) el.parentNode?.removeChild(el);
};
export function setupAccessDirective(app: App) {
  app.directive('access', accessDirective);
}
